package org.example.NestedClass_011;

public class Main {
    public static void main(String[] args) {
        Outer outer = new Outer("Nested"); // 实例化一个Outer
        Outer.Inner inner = outer.new Inner(); // 实例化一个Inner
        inner.hello(); //Hello, Nested

//        报错
//        Inner inner1 = Outer.new Inner();
        

    }
}

class Outer {
    //私有属性
    private String name;

    //有参构造方法
    Outer(String name) {
        this.name = name;
    }

    //内部类 Inner
    class Inner {
        //hello 方法
        void hello() {
            System.out.println("Hello, " + Outer.this.name);
        }
    }
}